library(Seurat)
## Warning: package 'Seurat' was built under R version 4.0.4
## Attaching SeuratObject
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.4
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.4
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(plotly)
## Warning: package 'plotly' was built under R version 4.0.4
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(cowplot)
library(SeuratWrappers)
library(monocle3)
## Loading required package: Biobase
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which.max, which.min
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## Loading required package: SingleCellExperiment
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## Warning: package 'matrixStats' was built under R version 4.0.4
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## The following object is masked from 'package:dplyr':
## 
##     count
## 
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## The following object is masked from 'package:Biobase':
## 
##     rowMedians
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: S4Vectors
## 
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:plotly':
## 
##     rename
## The following objects are masked from 'package:dplyr':
## 
##     first, rename
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## 
## Attaching package: 'IRanges'
## The following object is masked from 'package:plotly':
## 
##     slice
## The following objects are masked from 'package:dplyr':
## 
##     collapse, desc, slice
## The following object is masked from 'package:grDevices':
## 
##     windows
## Loading required package: GenomeInfoDb
## 
## Attaching package: 'SummarizedExperiment'
## The following object is masked from 'package:SeuratObject':
## 
##     Assays
## The following object is masked from 'package:Seurat':
## 
##     Assays
## 
## Attaching package: 'monocle3'
## The following objects are masked from 'package:Biobase':
## 
##     exprs, fData, fData<-, pData, pData<-
source("R:/People Folders/Connor/R_functions/Find_nCount_minimum.R")
source("R:/People Folders/Connor/R_functions/UMAP_params.R")

Here is how I have branches named now:

D59 = readRDS("D59_branches.RDS")

ggplotly(DimPlot(D59, group.by = "branch"))

Here are some cone, amicrine, and RGC markers

I notices that the cone stub does have more cone genes on than I thought, but it also blocks off

FeaturePlot(D59, c("OTX2", "CRX", "THRB", "RBP4", "TFAP2A", "POU4F2"), order = T)

FeaturePlot(D59, c("OTX2", "CRX", "THRB", "PRDM1", "TFAP2A", "POU4F2"), order = T)

FeaturePlot(D59, c("OTX2", "ATOH7", "THRB", "RBP4", "TFAP2A", "POU4F2"), order = T)

D59_3d = RunUMAP(D59, dims = 1:30, n.components = 3)
## Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
## To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
## This message will be shown once per session
## 11:14:01 UMAP embedding parameters a = 0.9922 b = 1.112
## 11:14:01 Read 3168 rows and found 30 numeric columns
## 11:14:01 Using Annoy for neighbor search, n_neighbors = 30
## 11:14:01 Building Annoy index with metric = cosine, n_trees = 50
## 0%   10   20   30   40   50   60   70   80   90   100%
## [----|----|----|----|----|----|----|----|----|----|
## **************************************************|
## 11:14:01 Writing NN index file to temp file C:\Users\reh_l\AppData\Local\Temp\RtmpKoK6IO\file4828538d334b
## 11:14:01 Searching Annoy index using 1 thread, search_k = 3000
## 11:14:02 Annoy recall = 100%
## 11:14:02 Commencing smooth kNN distance calibration using 1 thread
## 11:14:03 Initializing from normalized Laplacian + noise
## 11:14:03 Commencing optimization for 500 epochs, with 136520 positive edges
## 11:14:11 Optimization finished
D59_3d_frame = D59_3d@meta.data

D59_3d_frame = cbind(D59_3d_frame, D59_3d@reductions$umap@cell.embeddings)

#add genes
D59_3d_frame = cbind(D59_3d_frame, t(D59_3d@assays$RNA@data[c("OTX2", "CRX", "THRB", "RBP4", "TFAP2A", "POU4F2"),]))


plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~branch, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~OTX2, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~CRX, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~THRB, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~RBP4, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~TFAP2A, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
plot_ly(D59_3d_frame, x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3, color = ~POU4F2, size = 1)
## No trace type specified:
##   Based on info supplied, a 'scatter3d' trace seems appropriate.
##   Read more about this trace type -> https://plotly.com/r/reference/#scatter3d
## No scatter3d mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode

##ATAC data

d53_ATAC = readRDS("../d53_ATAC_branches2.RDS")

DimPlot(d53_ATAC, group.by = "branch")
## Loading required package: Signac
## Warning: package 'Signac' was built under R version 4.0.4
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
## 
## Attaching package: 'Signac'
## The following object is masked from 'package:Seurat':
## 
##     FoldChange

DefaultAssay(d53_ATAC) = "chromvar"

FeaturePlot(d53_ATAC, "OTX2", min.cutoff = 0)